package cn.tsmchina.one.domain.user;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.util.StringUtils;

/**
 * 会员信息
 * @author  YUE
 * @date 2013-9-2 上午10:56:18
 */
@Entity
@Table(name="tb_user")
public class User implements Serializable
{
	private static final long serialVersionUID = -5086945853302536250L;
	
	@Id
	@GeneratedValue
	private Long id;
	
	@Column(unique=true)
	private String phone;//电话、用户名
	
	@Column
	private String password;//密码
	
	@Column
	private String realName;//姓名
	
	@Column
	private String address;//收货地址
	
	@Column
	private String cardNo;
	
	@Column(unique=true)
	private String openId;//微信的openId;
	
	@Column(columnDefinition="int(1) default 0")
	private boolean delflag = false;//会员禁用
	
	@Column
	private Date createDate ;
	
	@Column
	private int credits;
	
	@Column
	private Long customerId;
	
	@Column 
	private Short gender;
	
	@Column
	private String birthday;
	
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = new Date();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = StringUtils.isEmpty(realName)?null:realName;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getPhone()
	{
		return phone;
	}

	public void setPhone(String phone)
	{
		this.phone = StringUtils.isEmpty(phone)?null:phone;
	}

	public String getOpenId()
	{
		return openId;
	}

	public void setOpenId(String openId)
	{
		this.openId = openId;
	}

	public boolean isDelflag()
	{
		return delflag;
	}

	public void setDelflag(boolean delflag)
	{
		this.delflag = delflag;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}
	
	public int getCredits() {
		return credits;
	}

	public void setCredits(int credits) {
		this.credits = credits;
	}
	
	public Long getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Long customerId) {
		this.customerId = customerId;
	}
	
	public Short getGender() {
		return gender;
	}

	public void setGender(Short gender) {
		this.gender = gender;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
}
